package k8.buffer;

import k8.buffer.var.VARVerticesBuffer;
import k8.buffer.vbo.VBOVerticesBuffer;

import org.lwjgl.opengl.GLContext;


public abstract class VerticesBuffer extends Buffer {
	
    /**
     * Creates an instance of VerticesBuffer.
     * 
     * @param initialcapacity
     *          Initial capacity (number of vertices)
     */
    public VerticesBuffer(int initialcapacity) {
        super(3*initialcapacity);
    } 
    
    /**
     * Gets an instance of VerticesBuffer.
     * 
     * @param initialcapacity
     *          Initial capacity (number of vertices)
     */
    public static VerticesBuffer getInstance(int initialcapacity) {
        return ( GLContext.getCapabilities().GL_ARB_vertex_buffer_object ) ? new VBOVerticesBuffer(initialcapacity) : new VARVerticesBuffer(initialcapacity);
    }
    
    /** Gets a Slice of this buffer */
    public Slice getSlice() {
    	return getSlice(36);
    }
    
    /** Tells OpenGL this buffer contains the vertices */
    public abstract void glVertexPointer();

}
